<template>
  <div>
    <div @click="getToken1" class="mybuttons">获取token</div>
    <div @click="getToken2" class="mybuttons">图类型字典查询</div>
    <div class="mydiv">
      <div v-for="(item, i) of txlziArr" :key="i" @click="txlzdClick(item)">{{ item.maptypename }}</div>
    </div>
    <div @click="getToken3" class="mybuttons">要素类型分组字典查询</div>
  </div>
</template>
<script>
import { getGisToken, getGisTlxZd, getGisYslxFzzd, getGisTclxjh } from "../api/gisMap";
export default {
  data() {
    return {
      txlziArr: []
    };
  },
  methods: {
    txlzdClick(item) {
      getGisTclxjh(item.maptypeid).then(res => {
        console.log(res);
      });
    },
    getToken1() {
      getGisToken().then(res => {
        if (res.status === 200) {
          const data = res.data;
          if (data.code === 10000 && data.resultValue) {
            const token = data.resultValue.token;
            sessionStorage.setItem("gisMapToken", token);
          }
        }
      });
    },
    getToken2() {
      getGisTlxZd().then(res => {
        if (res.status === 200) {
          const data = res.data;
          if (data.code === 10000 && data.resultValue) {
            this.txlziArr = data.resultValue;
          }
        }
      });
    },
    getToken3() {
      getGisYslxFzzd().then(res => {
        console.log("图类型字典查询", res);
      });
    }
  }
};
</script>
<style lang="less" scoped>
.mybuttons {
  color: #fff;
  padding: 10px;
  border: 1px solid #fff;
}
.mydiv {
  display: flex;
  div {
    padding: 10px;
    border: 1px solid #fff;
    color: #fff;
  }
}
</style>
